package lin.zhihong.redme.jpa.controller;

import lin.zhihong.redme.jpa.entity.Article;
import lin.zhihong.redme.jpa.repository.ArticleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/")
public class ArticleController {

    @Autowired
    private ArticleRepository articleRepository;

    @GetMapping("/findAll")
    public List<Article> findAll() {
        return articleRepository.findAll();
    }
}
